package com.yidu.BusinessParament.mapper;
/**
 * 债券信息设置dao层
 * @type:BondMapper interface
 * @version:v1.0
 * @authod:周楠樱木
 * @date:2020-09-01
 */

import com.yidu.BusinessParament.entity.Bond;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface BondMapper {
    @Select("select * from bond where 1 = 1 ${sqlWhere} limit #{page},#{limit}")
    List<Bond> selectBond(Map map);
    /**
     * 通过条件查询总页数
     * @param map 查询的条件
     * @return int 总行数
     */
    @Select("select count(*) from bond where 1=1 ${sqlWhere}")
    /**
     * 通过条件查询总页数
     * @param map 查询的条件
     * @return int 总行数
     */
    int getSumRow(Map map);
    //增加
    @Insert("insert into bond(bondId,bondName,bearingStart,bearingEnd,bondType,faceAmount,bondInterest,delayDate,interestTime,bondRemark,Remark) values\n" +
            "        (${bondId},#{bondName},#{bearingStart},#{bearingEnd},#{bondType},#{faceAmount},#{bondInterest},#{delayDate},#{interestTime},#{bondRemark},1)")
    int insertBond(Bond bond);
    //删除
    int  deleteBond(List bondId);
    //修改
    @Update("update bond set bondName=#{bondName},bearingStart=#{bearingStart},bearingEnd=#{bearingEnd},bondType=#{bondType},faceAmount=#{faceAmount},bondInterest=#{bondInterest},delayDate=#{delayDate},interestTime=#{interestTime},bondRemark=#{bondRemark},Remark=1  where bondId=#{bondId}")
    int updateBond(Bond bond);
}
